package com.it.demo;

import java.sql.Time;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author げっしょく
 * @date 2021/8/7
 */
public class Demo2 {

    public static void main(String[] args) {
        ThreadPoolExecutor tpe = new ThreadPoolExecutor(5,6,60, TimeUnit.SECONDS,new ArrayBlockingQueue<>(9), Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());
        Runnable r = new Runnable(){
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + "在执行");
            }
        };
        tpe.submit(r);
        tpe.submit(r);
        tpe.submit(r);
        tpe.submit(r);
        tpe.submit(r);
        tpe.submit(r);
        tpe.submit(r);
        tpe.submit(r);
        tpe.submit(r);
        tpe.shutdown();
    }
}
